<%--
  Created by IntelliJ IDEA.
  User: WanMing
  Date: 2019/2/7
  Time: 18:13
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>添加号段</title>
    <link rel="stylesheet" href="${ctx}/resources/layui/css/layui.css" media="all">
    <script src="${ctx}/resources/js/jquery.js"></script>
    <script type="text/javascript" src="${ctx}/resources/layui/layui.js"></script>
</head>
<body>

<div style="padding: 20px; background-color: #F2F2F2;">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">生成号码</div>
                <div class="layui-card-body">

                    <form class="layui-form" action="" id="mobileForm">
                        <div class="layui-form-item">
                            <label class="layui-form-label">号码类型:</label>
                            <div class="layui-input-block">
                                <input type="radio" name="mobileType" value="SIM" title="SIM" checked="">
                                <input type="radio" name="mobileType" value="UIM" title="UIM">
                            </div>
                        </div>


                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">号段范围:</label>
                                <div class="layui-input-inline" style="width: 400px;">
                                    <input type="number" name="strNumber" placeholder="请输入开始号段" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid">-</div>
                                <div class="layui-input-inline" style="width: 400px;">
                                    <input type="number" name="endNumber" placeholder="请输入结束号段" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                    </form>

                    <%--注意此处的按钮应该放在表单外面，防止两次表单提交的影响--%>
                    <div class="layui-form-item">
                        <div class="layui-input-block" style="text-align: center">
                            <button class="layui-btn" id="butSubmit">提交</button><span style="width:60px;display: inline-block"></span>
                            <button type="reset" class="layui-btn layui-btn-primary" id="resetMobile">重置</button>
                        </div>
                    </div>


                </div>
            </div>
        </div>
    </div>
</div>




<script>

    layui.use(['layer', 'jquery','form'], function () {
        var layer = layui.layer;
        var $ = layui.jquery;
        var form = layui.form;


        //提交表单
        $("#butSubmit").click(function () {

            $.ajax({
                url: "${ctx}/mobile/addMobile.action",
                type: "post",
                data: $("#mobileForm").serialize(),
                dataType: "text",
                success: function (obj) {

                    if (obj.code == 1) {
                        console.log("添加成功");
                    }
                },
                error: function (xhr, text) {
                    console.log(text);
                },
                complete: function (xhr, text) {
                    location.href = "${ctx}/mobile/toAddMobile.action";
                }
            });
        });


    });

</script>
</body>
</html>
